package com.lh;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.lang.reflect.Method;
import java.util.List;
import java.util.Map;

/**
 * @author: linghao
 * @since: 2022/12/3
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class RuleFact {

    private String proGroupId;
    private String bussinessType;
    private Map<String,Object> fieldToValue;
    private String ruleRet;
    private List<String> scopes;

    public static boolean testdrl(String name,String className) throws Exception {
//        Company.testdrl();
        Class<?> aClass = Class.forName(className);
        if(null == aClass){
            throw new IllegalArgumentException("aClass excption");
        }
        Method method = aClass.getDeclaredMethod("testdrl", String.class);
        method.invoke(null,"nihao");
//        Object o = aClass.newInstance();
//        if(!(o instanceof Company)){
//            throw new IllegalArgumentException("excption");
//        }
//        Object o = aClass.newInstance();
//        Method m = aClass.getMethod("foo", String.class);
//        m.invoke(o, Integer.toString(i));
        System.out.println("====test1drl=:"+name);
        return true;
    }
}
